//34.当前元素的前一个元素
function prev(ele) {
    return ele.previousElementSibling || ele.previousSibling;
}

//35.当前元素的后一个元素
function next(ele) {
    return ele.nextElementSibling || ele.nextSibling;
}

//36.当前元素的父元素
function parent(ele) {
    return ele.parentElement;
}

// 此处对ajax 进行了二次封装  => 调用ajax请求,返回进行中状态的Promise实例
function requset(url, data = {}, type = "get") {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: type,
            url: url,
            data: { ...data },
            dataType: "json",
            success(obj) {
                resolve(obj);
            }
        });

    });
}

const shoppingCar = () => requset("../data/shoppingCar.json");